package com.enlorenz.core.engine.imp.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.enlorenz.common.util.ExceptionUtils;
import com.enlorenz.core.engine.IBuzHandler;

public class ElzQuartzJob implements  Job{
	public static final String BUZ_HANDLER_KEY="buzHandler";
	//日志对象 实现类可复用此日志对象
	protected Logger logger=LoggerFactory.getLogger(this.getClass());
	
	public void execute(JobExecutionContext context) throws JobExecutionException {
		
		IBuzHandler buzHandler=(IBuzHandler)context.getJobDetail().getJobDataMap().get(BUZ_HANDLER_KEY);
		try {
			 buzHandler.handle();
		} catch (Exception e) {
			try{
				logger.error(ExceptionUtils.getExpStr(e));
			}catch (Exception exx) {
				exx.printStackTrace();
			}
		}
	 }

}
